Skip to content

Stg bugfixes#74

Merged
srt0422 merged 3 commits into
devfrom
stg-test
Sep 23, 2023
Merged

Stg bugfixes#74
srt0422 merged 3 commits into
devfrom
stg-test

Conversation

@srt0422
Copy link
Copy Markdown
Contributor

@srt0422 srt0422 commented Sep 23, 2023

No description provided.

@srt0422 srt0422 changed the base branch from stg to dev September 23, 2023 01:18
Comment on lines 7 to 14
case '421613':
baseURL = 'https://api-goerli.arbiscan.io/api'
break
case '42161':
baseURL = 'https://api.arbiscan.io/api'
break
default:
throw new Error(`Unsupported chain ${chainId}`)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current approach of hardcoding the URLs for different chains is not maintainable. If the URLs change in the future, or if new chains are added, the code will need to be updated and redeployed. A more maintainable approach would be to store these URLs in a configuration file or environment variables. This way, changes can be made without modifying the code.

Comment on lines 15 to 23
const etherscanApi = createEtherscanApi(chainId)
const blockscoutApi = createBlockscoutApi(chainId)
apis.push(etherscanApi, blockscoutApi)
break;
break
case '421613':
case '42161':
const arbiscanApi = createArbiscanApi(chainId)
apis.push(arbiscanApi)
break
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation creates multiple API instances regardless of the chainId. This could lead to unnecessary memory usage and potential performance issues if the number of APIs grows. It would be more efficient to create only the API instance that corresponds to the provided chainId.
To improve this, consider refactoring the code to create and push the API instance into the apis array only when the chainId matches the specific case. This way, you only instantiate the necessary API, which can help optimize memory usage and improve performance.

@srt0422 srt0422 merged commit b194ab1 into dev Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant